package com.heima.controller.web;

import com.heima.controller.exception.BusinessException;
import com.heima.pojo.Business;
import com.heima.service.BusinessService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@Slf4j
@RestController
@RequestMapping("/api/vm-service/businessType")
public class BusinessController {


    @Autowired
    private BusinessService businessService;


    /**
     * 分页查询
     * 查询区域详情信息
     *
     * @return
     */
    @GetMapping()
    public List<Business> findAllBusinessType() {

        List<Business> list = businessService.list(null);
        if (list.size()==0) {
            throw new BusinessException("没有商圈数据");
        }
        return list;
    }
}
